TARGET = obj
CC = gcc
CFLAGS = -Wall -c

SOURCE = main.c func.c

ifdef SOURCE
# 变量的另一个用法
	OBJ = $(SOURCE:.c=.o)
else
	OBJ = $(SOURCE)
endif


$(TARGET):$(OBJ)
	$(CC) -o $(TARGET) $(OBJ)

main.o:main.c
	$(CC) $(CFLAGS) main.c

func.o:func.c
	$(CC) $(CFLAGS) func.c



print:
	@echo OBJ: $(OBJ)
clean:
	rm *.o obj
